import ajax from './ajax'

export default {

  CURRENT : false,

  loadEventSeatMap(eventId, onSuccess) {
    ajax.get('/taobao/events/'+eventId+'/seats').then(onSuccess);
  },

  saveEventSeatMap(eventId, data, onSuccess) {
    ajax.post('/taobao/events/'+eventId+'/seats', data)
        .then(onSuccess)
        .catch(err=>{console.log(err)});
/*
    setTimeout(() => {
      onSuccess({data:{model:data}})
    }, 500);*/
  },

  searchCity(query, onSuccess) {
    ajax.get('/taobao/search/cities?q=' + query).then(onSuccess);
  },

  searchCinema(cityId, area, query, onSuccess) {
    ajax.get('/taobao/search/cinemas?q=' + query + "&city=" + cityId + "&area=" + area).then(onSuccess);
  },

  searchSeatMap(cinemaId, hallName, onSuccess) {
    ajax.get('/taobao/search/seats?cinemaId=' + cinemaId + '&hallName=' + hallName).then(onSuccess);
  }

}